#pragma once

#include "D3DX.h"
#include "D3DXDefines.h"

class D3DXRenderer
{
public:
	D3DXRenderer(D3DX* dx);
	~D3DXRenderer();

	void AddRenderListener( RenderListener* listener );
	void DelRenderListener( RenderListener* listener );
	bool GatherRenderData();
	bool Render();

	void SetIB( RenderData* renderData, LPDIRECT3DDEVICE9 device );

	void SetVB( RenderData* renderData, LPDIRECT3DDEVICE9 device );

	void SetRenderState( RenderData* renderData, LPDIRECT3DDEVICE9 device );


private:
	D3DX* mDX;
	std::vector<RenderListener*> mRenderListener;

	typedef std::map<RenderData*, LPDIRECT3DVERTEXBUFFER9> VBMap;
	VBMap mVBList;
	typedef std::map<RenderData*, LPDIRECT3DINDEXBUFFER9> IBMap;
	IBMap mIBList;
	
	RenderDataList mRenderDataList;
};